package cn.stylefeng.guns.sys.modular.system.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.sys.modular.system.entity.BtyArchives;
import cn.stylefeng.guns.sys.modular.system.entity.BtyWx;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.guns.sys.modular.system.mapper.BtyWxMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class BtyWxService extends ServiceImpl<BtyWxMapper, BtyWx> {

    @Resource
    private BtyWxMapper mapper;

    /**
     * 获取档案管理列表
     *
     * @author fengshuonan
     * @Date 2018/12/23 6:05 PM
     */

    public Page<Map<String, Object>> list(String name, String shopName, String tel, String phone,
                                          String post, Long deptId,String regionOne, String regionTwo) {
        Page page = LayuiPageFactory.defaultPage();

        return this.baseMapper.list(page, name,shopName,tel,phone,post,deptId,regionOne,regionTwo);
    }

    /**
     * 添加数据
     * @param btyWx
     * @return
     */
    public int add(BtyWx btyWx) {
        return mapper.add(btyWx);
    }

    /**
     * 查询职务
     * @return
     */
    public List<BtyArchives> getPost() {
        return mapper.getPost();
    }

    /**
     * 查询一级区域
     * @return
     */
    public List<BtyArchives> getRegionOne() {
        return mapper.getRegionOne();
    }

    /**
     * 查询二级区域
     * @param region
     * @return
     */
    public List<BtyArchives> getRegionTwo(String region) {
        return mapper.getRegionTwo(region);
    }

    /**
     * 查询数据库中是否存在此人
     * @param openId
     * @return
     */
    public User selectUser(String openId) {
        return mapper.selectUser(openId);
    }
}
